Delete an alignment
Geometric model is container for alignments, and to delete an existing alignment, the alignment needs to be deleted from geometric model. The below code snippet shows how the alignment is deleted.
Example
internal void DeleteAlignment()
{
//Get the current active connection of type ConsensusConnectionEdit
Bentley.CifNET.SDK.ConsensusConnection con = Bentley.CifNET.SDK.Edit.ConsensusConnectionEdit.GetActive();
if (con == null) return;
//Get geometric model
Bentley.CifNET.GeometryModel.SDK.GeometricModel geomModel = con.GetActiveGeometricModel();
//Get all alignments from Geometric model
foreach (Alignment al in geomModel.Alignments)
{
//Delete alignment
al.Element.DeleteFromModel();
}
return;
}
Element.DeleteFromModel() is used to delete the alignment from current dgn.